package CandyCraft.common;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ModelCandyGiraffe extends ModelBase
{
	  //fields
	    ModelRenderer leg1;
	    ModelRenderer leg2;
	    ModelRenderer leg3;
	    ModelRenderer leg4;
	    ModelRenderer Body;
	    ModelRenderer Neck;
	    ModelRenderer Head;
	    ModelRenderer Horn1;
	    ModelRenderer Horn2;
	  
	  public ModelCandyGiraffe()
	  {
	    textureWidth = 96;
	    textureHeight = 32;
	    
	      leg1 = new ModelRenderer(this, 0, 17);
	      leg1.addBox(0F, 0F, 0F, 3, 12, 3);
	      leg1.setRotationPoint(3F, 12F, 5F);
	      leg1.setTextureSize(96, 32);
	      leg1.mirror = true;
	      setRotation(leg1, 0F, 0F, 0F);
	      leg2 = new ModelRenderer(this, 0, 17);
	      leg2.addBox(0F, 0F, 0F, 3, 12, 3);
	      leg2.setRotationPoint(-6F, 12F, 5F);
	      leg2.setTextureSize(96, 32);
	      leg2.mirror = true;
	      setRotation(leg2, 0F, 0F, 0F);
	      leg3 = new ModelRenderer(this, 0, 17);
	      leg3.addBox(0F, 0F, 0F, 3, 12, 3);
	      leg3.setRotationPoint(3F, 12F, -8F);
	      leg3.setTextureSize(96, 32);
	      leg3.mirror = true;
	      setRotation(leg3, 0F, 0F, 0F);
	      leg4 = new ModelRenderer(this, 0, 17);
	      leg4.addBox(0F, 0F, 0F, 3, 12, 3);
	      leg4.setRotationPoint(-6F, 12F, -8F);
	      leg4.setTextureSize(96, 32);
	      leg4.mirror = true;
	      setRotation(leg4, 0F, 0F, 0F);
	      Body = new ModelRenderer(this, 30, 4);
	      Body.addBox(0F, 0F, 0F, 12, 10, 18);
	      Body.setRotationPoint(-6F, 2F, -9F);
	      Body.setTextureSize(96, 32);
	      Body.mirror = true;
	      setRotation(Body, 0F, 0F, 0F);
	      Neck = new ModelRenderer(this, 12, 13);
	      Neck.addBox(0F, 0F, 0F, 4, 15, 4);
	      Neck.setRotationPoint(-2F, -13F, 8F);
	      Neck.setTextureSize(96, 32);
	      Neck.mirror = true;
	      setRotation(Neck, -0.1570796F, 0F, 0F);
	      Head = new ModelRenderer(this, 0, 0);
	      Head.addBox(0F, 0F, 0F, 6, 4, 9);
	      Head.setRotationPoint(-3F, -17F, 8F);
	      Head.setTextureSize(96, 32);
	      Head.mirror = true;
	      setRotation(Head, -0.1570796F, 0F, 0F);
	      Horn1 = new ModelRenderer(this, 0, 13);
	      Horn1.addBox(0F, 0F, 0F, 1, 3, 1);
	      Horn1.setRotationPoint(1F, -19F, 9F);
	      Horn1.setTextureSize(96, 32);
	      Horn1.mirror = true;
	      setRotation(Horn1, -0.1570796F, 0F, 0F);
	      Horn2 = new ModelRenderer(this, 0, 13);
	      Horn2.addBox(0F, 0F, 0F, 1, 3, 1);
	      Horn2.setRotationPoint(-2F, -19F, 9F);
	      Horn2.setTextureSize(96, 32);
	      Horn2.mirror = true;
	      setRotation(Horn2, -0.1570796F, 0F, 0F);
	  }
	  
	  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
	  {
	    super.render(entity, f, f1, f2, f3, f4, f5);
	    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	    leg1.render(f5);
	    leg2.render(f5);
	    leg3.render(f5);
	    leg4.render(f5);
	    Body.render(f5);
	    Neck.render(f5);
	    Head.render(f5);
	    Horn1.render(f5);
	    Horn2.render(f5);
	  }
	  
	  private void setRotation(ModelRenderer model, float x, float y, float z)
	  {
	    model.rotateAngleX = x;
	    model.rotateAngleY = y;
	    model.rotateAngleZ = z;
	  }
	  
	  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
	  {
	    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	    this.Head.rotateAngleX = f4 / (180F / (float)Math.PI);
	    this.Head.rotateAngleY = f3 / (180F / (float)Math.PI);
	    this.leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
	    this.leg2.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
	    this.leg3.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
	    this.leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
	  

 

}
}
